package org.csu.mypetstore.persistence;

import org.apache.ibatis.annotations.Param;
import org.csu.mypetstore.domain.Cart;
import org.csu.mypetstore.domain.CartItem;
import org.csu.mypetstore.domain.Item;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.Iterator;
import java.util.List;

@Repository
public interface CartMapper {
    void insertCart( Item item,  String userId);
    void deleteCart(String userId);
    Cart getCart(String userId);
    void deleteCartItemById(String itemId);
    void update(@Param("itemid") String itemid,@Param("userId") String userId,@Param("quantity") int quantity);
    List<CartItem> getCartItemListByUserName(String userid);
    void incrementQuantityByItemId(@Param("quantity")int quantity,@Param("totalprice")BigDecimal totalprice,@Param("userId")String userId,@Param("itemId")String itemId);
    int getQuantityByItemAndUserId(@Param("userId")String userId,@Param("itemId")String itemId);
    BigDecimal getListPriceByItemAndUserId(@Param("userId")String userId, @Param("itemId")String itemId);
    void insertAccount(@Param("userId")String userId,@Param("itemId")String itemId,@Param("productId")String productId,@Param("attribute1")String attribute1, @Param("bool")Boolean bool,@Param("quantity")int quantity,@Param("listPrice")BigDecimal listPrice,@Param("listPrice1")BigDecimal listPrice1);
    void removeAllByUserName(String userId);
}
